package rnn.utilities;

import java.util.List;

import rnn.RNN.NNContainer;

public class SimilarityProofThread extends Thread {

	private List<Element> chain;
	private Element e;

	public NNContainer result;

	public SimilarityProofThread() {

	}

	public void set(List<Element> chain, Element e) {
		this.chain = chain;
		this.e = e;
	}

	@Override
	public void run() {
		float bestSim = -1;
		Element bestElement = null;

		// for (int i = startIndex; i < chain.size(); i++) {
		for (Element elementOfList : chain) {
			// Element elementOfList = chain.get(i);

			if (elementOfList != e) {
				float sim;

				sim = e.sim(elementOfList);

				if (sim > bestSim) {
					bestSim = sim;
					bestElement = elementOfList;
				}

			}
		}
		result = new NNContainer(bestElement, bestSim);
	}
}
